﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using Modules.Core;

namespace ComputerStoreManager.ViewModel {
    public delegate void OnAddProductEventHander();
    public delegate void OnViewProductEventHander();
    public class ProductControlViewModel {
        #region ICommand
        public ICommand AddProductCommand {
            get;
            private set;
        }
        public ICommand ViewProductCommand {
            get;
            private set;
        }
        #endregion

        #region Events
        public event OnAddProductEventHander OnAddProductClicked;
        public event OnViewProductEventHander OnViewProductClicked;
        #endregion

        public void InitCmd() {
            AddProductCommand = new ExecutableCommand(DoAddProduct);
            ViewProductCommand = new ExecutableCommand(DoViewProduct);
        }

        public void DoAddProduct() {
            if (OnAddProductClicked != null) {
                OnAddProductClicked();
            }
        }

        public void DoViewProduct() {
            if (OnViewProductClicked != null) {
                OnViewProductClicked();
            }
        }

        #region Constructor
        public ProductControlViewModel() {
            InitCmd();
        }
        #endregion
    }
}
